#!/bin/sh

export args=$1

function on_function()
{
	echo 0 > /sys/class/gpio/gpio56/value
	echo 1 > /sys/class/gpio/gpio57/value
	sleep 0.1;
	echo 0 > /sys/class/gpio/gpio56/value
	echo 0 > /sys/class/gpio/gpio57/value
}

function off_function()
{
	echo 1 > /sys/class/gpio/gpio56/value
	echo 0 > /sys/class/gpio/gpio57/value
	sleep 0.1;
	echo 0 > /sys/class/gpio/gpio56/value
	echo 0 > /sys/class/gpio/gpio57/value
}

if test ! -f /sys/class/gpio/gpio56/value; then
    echo 56 > /sys/class/gpio/export
    echo out > /sys/class/gpio/gpio56/direction
    echo 0 > /sys/class/gpio/gpio56/value
fi

if test ! -f /sys/class/gpio/gpio57/value; then
    echo 57 > /sys/class/gpio/export
    echo out > /sys/class/gpio/gpio57/direction
    echo 0 > /sys/class/gpio/gpio57/value
fi

on_function
sleep 0.5;
off_function

case $args in
	on)
		on_function
		;;
	off)
		off_function
		;;
	-h)
		echo 'Options: on off '
		;;
	*)
		echo 'Use '-h' to display command line options of sub-processes'
		;;
esac
